/**
 * AggregationUpdateFunction.java
 * ************************** 
 * @date Mar 30, 2011
 * @author Michele Tamburini
 * 
 * **************************
 */
package gossipServices.aggregation.functions;

/**
 * Description: 
 * This interface regulates the parameter of a 
 * valid UPDATE function for the Aggregation
 * protocol. 
 *  - sp is the current local value of the node;
 *  - sq is the incoming value from another node.
 * A valid function must accept in input 
 * two double parameter (sp, sq) and return a double.
 * Examples of valid function are 
 *   mean: return ((sp+sq)/2)
 *   max: return max(sp,sq)
 *   min: return min(sp,sq)
 * 
 * The result of the UPDATE function is 
 * supposed to be the new estimation value
 * of the local node. 
 *
 */
public interface AggregationUpdateFunction {

	/**
	 * Defines the instruction of the UPDATE
	 * function in a node.
	 * 
	 * @param sp:double
	 * @param sq:double
	 * @return result:double
	 */
	public double update(double sp, double sq);
}
